It isn't a MOSFET because the gate-source voltage would be 24V.
It seems to be a bipolar PNP transistor, maybe a Darlington (depends on how much current the relay needs).
2N2222 is NPN, so it will not work.
Measure the base-emitter forward diode voltage (negative probe to the base) on the transistor from a working unit. If the voltage is more than 1V, it is a Darlington.
The easiest way to measure without desoldering is to measure using the multimeter DC voltage setting on a working unit when the relay is activated.
If you measure using the multimeter diode function when a working board is not powered, other components can disturb the reading.
If not a Darlington, you can try a BC807.