UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K4Z1in0OjGKDIcg2jzaTmRuqWBQUt2H/nyVN468bVyw='
WHERE
key_id = '7ed40ede15b2a748d2c9beccf696d856a3d302ba9568d4ba77000d5336832e01'
AND (
token = 'K4Z1in0OjGKDIcg2jzaTmRuqWBQUt2H/nyVN468bVyw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)