Proper approach would be to buy an isolated differential probe that can withstand high voltage.
If you only want to see the switching time varying in relation with the mains, so no precise measurements, a simple loop of wires placed nearby the tested circuit might be enough (no direct contact and no transformer, just a loop of wire. At first, you can simply clip the GND wire to the tip, and try to see the switching moment (synchronize the oscilloscope internally, from Line/Mains). Something like this:
Might not show the proper waveform, but it should reveal at least the switching moment relative to mains zero crossing.
Speaking for myself only, if no proper differential probe available yet the precise voltage waveform is needed, I would try to float the oscilloscope entirely, by powering the oscilloscope from batteries, or from an isolation transformer. If you do so, don't connect to the oscilloscope any other cables than the probes (I mean no USB, or LAN or GPIB or serial, or grounding, etc.), and avoid touching any metallic parts of the oscilloscope.
There are also hand-held oscilloscopes powered from rechargeable batteries by design, if you can borrow one.
Beware that the GND of the probes and the grounding wire from the mains power cable are usually connected together internally, inside the oscilloscope, so beware of unintended short circuits made through the GND of the probes and the rest of the metallic parts of the oscilloscope or the mains grounding wire.
Again, floating the oscilloscope might be dangerous if you don't know very well the possible dangers, whatever you do, the outcome is entirely your own responsibility.