UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 't04uKM7v0cMswCUvfEf2Iv5lLtaXtk2CRQsX4XAiisw='
WHERE
key_id = 'bc71d0d413fb35cfbc4c59fb503128a289e8288862f9c7af2e096bbab936877d'
AND (
token = 't04uKM7v0cMswCUvfEf2Iv5lLtaXtk2CRQsX4XAiisw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)