UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BRCGEj0qZNtMvHgy/nJ9PBNqvQjGT9fiDAmUbtZiOZ8='
WHERE
key_id = 'df81f9f7329bb5acf3e1ebf9a9b1e8b88eb9939e21f618d5e4c048f1746e96ec'
AND (
token = 'BRCGEj0qZNtMvHgy/nJ9PBNqvQjGT9fiDAmUbtZiOZ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)