First and second order optimality conditions in set optimization