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