UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QN81SJfAlLQqp8kv1usw6uhQ0Lip1BrBHl/cxFW7zHM='
WHERE
key_id = '52695e9e90bef7c44605b64447db595e5dfe770320e47801834162feaebd9d76'
AND (
token = 'QN81SJfAlLQqp8kv1usw6uhQ0Lip1BrBHl/cxFW7zHM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)