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