Replacing an EX4200-48P with an EX3400-48P is fine. There is no need to 'must' go with EX4200-48PX. Please note the EX3400 using newer "ELS Cli" vs older EX4200 so some conversion of your config will be required. There is an ELS conversion tool to assist you with this.
As for optics, you are talking about for UpLink module, which on EX3400 is built-in ports. Yes those optics should be fine to move to new switch, and if they were Juniper purchased Optics, and your EX4200-48P (and your new EX3400-48P) are both under Support, the Optics should still be covered as well. Support (outside of Core or Core Plus, I believe) covers the switch and everything related to it, including Optics.
Also note that if this switch is to be part of a VC, the whole VC will need to be EX3400 based, and that VC connectivity is generally provided by the 40GE interfaces, via 40GE DAC cables, vs older VC cables with EX4200 family.