UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WD6orGHb8k9A3HWiX/d8aMsYBblc/Eu686VTUVWtobU='
WHERE
key_id = '6c181050b87d968772e77cffed82d84edecb2f946a558973ab5647ed59c4e8bb'
AND (
token = 'WD6orGHb8k9A3HWiX/d8aMsYBblc/Eu686VTUVWtobU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)