UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NaySM/jTmmENr3MB4fUgMID+qLWGUjyDL+MScSlPdiY='
WHERE
key_id = 'aec9521dd60676bcda6288a6071740de6c0b59f198ea4c493d41e98e3700eb0d'
AND (
token = 'NaySM/jTmmENr3MB4fUgMID+qLWGUjyDL+MScSlPdiY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)