Mass of Kerr-Newman black holes in an external magnetic field