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