UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7Zi5CLJcQUOjQcyQruaAI4rmc9ETgtg1Z6wFTCn5984='
WHERE
key_id = '9f7783ad795f6655b4ee17e9cf5612b62a03c9e9f02ba0795deda01e326a8b38'
AND (
token = '7Zi5CLJcQUOjQcyQruaAI4rmc9ETgtg1Z6wFTCn5984='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)