UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GZj8nx4h1gjtqwfnnWJZPR2kMi4H7nYd7IqhPQSjlT4='
WHERE
key_id = '1c12df5e3d7777c039baab6327f8c7ab97b0ddfde60c0802485270439f8fbd1b'
AND (
token = 'GZj8nx4h1gjtqwfnnWJZPR2kMi4H7nYd7IqhPQSjlT4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)