UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ctDqy0MrJkstMcD6pTe4oAFOWwYbxp3n0evM1TWR54M='
WHERE
key_id = 'c22c6cc92d8e03a4ac01648fb7608708eb60827aac1f25986ccd0b3df5f6d02e'
AND (
token = 'ctDqy0MrJkstMcD6pTe4oAFOWwYbxp3n0evM1TWR54M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)