UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rOdvKEjI9q50dEHEyhlwp4aqUGbJuG8NE7y9irYeoa0='
WHERE
key_id = '39c943bd8c93a1e5201c0918f0d5c4c15bf7679c45ec2c79f790821fc2c1dae1'
AND (
token = 'rOdvKEjI9q50dEHEyhlwp4aqUGbJuG8NE7y9irYeoa0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)