UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WhnAqdjJv8qRMhwAH6fUoFG/odUAB3I2LohXYiLLr34='
WHERE
key_id = 'b0b585510b8428cc06060efc765b2e898bffb9c870893041acb6c78e9ffe42cf'
AND (
token = 'WhnAqdjJv8qRMhwAH6fUoFG/odUAB3I2LohXYiLLr34='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)