UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hLLfRU22uvS+3XFjz8nbxz2IguOlxmAiRPxsfeu5oYE='
WHERE
key_id = '9f7bca9ce4b195f8bc1c89c6b84838c5b5a6d178ccf8e29f504451c6d7b3c39a'
AND (
token = 'hLLfRU22uvS+3XFjz8nbxz2IguOlxmAiRPxsfeu5oYE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)