First- and second-order optimality conditions for optimal control problems of state constrained integral equations