Existence and uniqueness of the solutions to second order abstract equations with nonlinear and nonmonotone boundary conditions