UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KLHBZVzfUfJ7rqfRAzCahFjNwzB1ntARZs+atzr0fVk='
WHERE
key_id = '8e282173f269fb7fc5799f3f0d209910617c2351f84097af35d7965c8cfd789b'
AND (
token = 'KLHBZVzfUfJ7rqfRAzCahFjNwzB1ntARZs+atzr0fVk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)