UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '82qdMTP9jTmx+qaWQMxci9XefDap0KkYdUESOBkSG48='
WHERE
key_id = '821c9d8ee18cf920567d1d4c94736c33753dfd93f9170902d3cecf2697c0dc0e'
AND (
token = '82qdMTP9jTmx+qaWQMxci9XefDap0KkYdUESOBkSG48='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)