UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M0ihnFT821gogIOJCeuufK2Z1kdnNy43q/e6rNDbwRc='
WHERE
key_id = 'a9ed513473b16eca637c22d15ba9bf1cffd41daaaf830aee72de73163fcab92e'
AND (
token = 'M0ihnFT821gogIOJCeuufK2Z1kdnNy43q/e6rNDbwRc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)