This paper studies an unmanned aerial vehicle (UAV)-enabled wireless powered mobile edge computing (MEC) system, where a UAV, equipped with RF Chains and MEC servers, can sustainably provide wireless energy for charging Internet of Things (IoT) devices and executing computing tasks from these devices while hovering at designated hover points. Our goal is to minimize the weighted sum of energy consumption and Age of information (AoI) in this system, which depended on the UAV’s hovering time at designated points and its flying time. To achieve this, we jointly optimize the deployment of hover points and the visiting order of these points by the UAV. It is NP hard and mixed-integer non-convex which is difficult to solve by traditional methods. To tackle this problem, we present a trajectory optimization algorithm for joint energy consumption and AoI (TOJEA), which consists of two phases. In the first phase, an Equilibrium Optimizer (EO) algorithm with a variable individual size via its coding and updating strategies, in which each particle (individual) with its concentration (position) represents a target solution i.e. the whole deployment of hover points, is proposed to optimize the number and locations of hover points. Based on the deployment of hover points, a low-complexity greedy algorithm is adopted in the second stage to generate the optimal visiting order for the UAV. Experimental results demonstrate that TOJEA outperforms other algorithms on ten instances with up to 400 IoT devices.