UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tR2VFZ5yv9eAOmKaztGs9+gxPnr1OI+fMtbWfNfILYs='
WHERE
key_id = '2b5b2046a497ba81d10acdd21e02954fa8d51c4c53365161c9654a7db50deff4'
AND (
token = 'tR2VFZ5yv9eAOmKaztGs9+gxPnr1OI+fMtbWfNfILYs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)