UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZT5aC1BNnMkq+X4T/NHdJNpUGxa6sYZMQnuYcTnI7vw='
WHERE
key_id = 'bb4adfccacf4d3ef7a470189e8ffc0c6cd4b85da5e76be2b2100cec3c7ec5bdd'
AND (
token = 'ZT5aC1BNnMkq+X4T/NHdJNpUGxa6sYZMQnuYcTnI7vw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)