UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fka0dqmNqkFAxRho8WYhzqEoWt6zLlp3G/MNEFFrjTc='
WHERE
key_id = '4d3a131bd3c258ba58dad930b85a5496218b89004893714618e1e31b331ee569'
AND (
token = 'fka0dqmNqkFAxRho8WYhzqEoWt6zLlp3G/MNEFFrjTc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)