UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fgmpnJfxt7T5deEu8ZH1HKVKfco1XFlTugIBStelI5E='
WHERE
key_id = '3e640e14e9e4c5ca74f8718da749f9db29bff2b99394e95b3fd5f5cb31012ac3'
AND (
token = 'fgmpnJfxt7T5deEu8ZH1HKVKfco1XFlTugIBStelI5E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)