UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '04FTlK3mPDD1ml8b1zllX/ljD0HhQ5YmZdklF2LKDi8='
WHERE
key_id = 'b79152d3df57756f80013c21d468a2606f6d78d1f99f988e7afa548b83423e7b'
AND (
token = '04FTlK3mPDD1ml8b1zllX/ljD0HhQ5YmZdklF2LKDi8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)