UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1liINBZE1VjaDj8ltPzPwLK9yINpOLcbtLhOVYsfZFg=' 
WHERE 
  key_id = 'a629ded247324bac3f18b4c22c6fcfeb2ca84495f89f90d356f7e2d910f11250' 
  AND (
    token = '1liINBZE1VjaDj8ltPzPwLK9yINpOLcbtLhOVYsfZFg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057