Hi,
The transistor in the circuit is not critical, thus I expect both BJTs to work properly.
You seem not to be very experienced. Thus be careful.
High voltage is dangerous. Don't risk your or someone else's life.
The 220k resistors need to be rated for sufficiently high voltage. At least half of 240V_peak voltage, but I recommend at least 500V.
Use safety creepage distance and isolation clearance at the optocoupler according your country's safety regulations.
Use a properly isolated case. Use properly isolated wiring.
Klaus