Recently, green networks are considered as one of the hottest topics in Information and Communication Technology (ICT), especially in mobile communication networks. In a green network, energy saving of network nodes such as base stations (BSs), switches, and servers should be achieved efficiently. In this paper, we consider a heterogeneous network architecture in 5G networks with separated data and control planes, where basically a macro cell manages control signals and a small cell manages data traffic. Then, we propose an optimized handover scheme based on context information such as reference signal received power, speed of user equipment (UE), traffic load, call admission control level, and data type. In this paper, the main objective of the proposed optimal handover is either to reduce the number of handovers or the total energy consumption of BSs. To this end, we develop optimization problems with either the minimization of the number of total handovers or the minimization of energy consumption of BSs as the objective function of the optimization problem. The solution of the optimization problem is obtained by particle swarm optimization, since the developed optimization problem is an NP hard problem. Performance analysis results via simulation based on various probability distributions of the characteristics of UE and BS show that the proposed optimized handover based on context information performs better than the previous call admission control based handover scheme, from the perspective of the number of handovers and total energy consumption. We also show that the proposed handover scheme can efficiently reduce either the number of handovers or the total energy consumption by applying either handover minimization or energy minimization depending on the objective of the application.