Optical-lattice-assisted magnetic phase transition in a spin-orbit-coupled Bose-Einstein condensate