UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A4IMyEvoB1E6XU7Osy+0XRlRhzBsLG+hYgsERrHMTRE='
WHERE
key_id = 'ad37b09a857fcaa65c25b76f691720783548f34008d4d333c1f837a6bb3c9d20'
AND (
token = 'A4IMyEvoB1E6XU7Osy+0XRlRhzBsLG+hYgsERrHMTRE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)