UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2iY5NmEpiPSiIkC7FgFIR5p0Hq6zXf8jh9FFBuOe7xE='
WHERE
key_id = 'cb71acae4d9c21aa93b6862225ab8ff89cac5d0f198c51ffa236b671874f812e'
AND (
token = '2iY5NmEpiPSiIkC7FgFIR5p0Hq6zXf8jh9FFBuOe7xE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)