UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ca0SzdQnRYKEkUtI9zvX3xkGka2l8/j7Vj34ofRWBEY='
WHERE
key_id = 'fbf6230318989479db5d8d3cfdc45935306df853b536e875b37d59e28a10a250'
AND (
token = 'Ca0SzdQnRYKEkUtI9zvX3xkGka2l8/j7Vj34ofRWBEY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)