We propose a generalized second-order asymptotic contingent epiderivative of a set-valued mapping, study its properties, as well as relations to some second-order contingent epiderivatives, and sufficient conditions for its existence. Then, using these epiderivatives, we investigate set-valued optimization problems with generalized inequality constraints. Both second-order necessary conditions and sufficient conditions for optimality of the Karush-Kuhn-Tucker type are established under the second-order constraint qualification. An application to Mond-Weir and Wolfe duality schemes is also presented. Some remarks and examples are provided to illustrate our results.