We consider a wireless powered two-way relay network in which a multi-antenna relay transfers power to devices and assists multi-pair data exchanges based on decode-and-forward with network coding in three phases. The relay in the network adopts energy beamforming (BF) for wireless power transfer, zero-forcing receive BF for multiple access decoding, and two-step transmit BF for efficient transmission of the network coded symbols by eliminating inter-pair interference. In this setup, we optimize energy the BF and transmit BF as well as the time allocation in order to maximize the rate fairness among the devices. The optimal energy BF is derived in closed-form for the network with two devices and is found by searching through the span of channel matched filters with more than two devices, while the optimal two-step transmit BF is given in closed-form for an arbitrary number of devices. In addition, the time allocation problem is shown to be convex and thus easily solved with the existing convex optimization solvers. The simulation results show that the proposed network outperforms conventional networks significantly due to the enhanced BF and flexible time allocation methods.