This is common enough on Lake Ontario in the spring and fall (with occasional bursts of "rolling" squalls in front of thunderheads) that it pays to practice. First thing is easy: look behind you occasionally. This stuff almost always comes from the west or the southwest on the lake, and so the greatest danger is getting caught going east in the morning: the vast cloud bank *won't* cross the sun before it's on you. 6string's advice was sound, so I won't repeat it here, but will add a little trick I've used on occasion...a little clip on rear view mirror. Properly positioned on the cabintop or clipped to a bimini frame, it's a way to glance backward without turning your head. Turning to look back over your shoulder is a good way to slew 10 degrees off course with a tiller...not what you want to do if you are getting pasted on a run.
Other than that, I actually think if you can drive the boat on a broad reach, you will be safer than if you attempt to round up to motor into the wind with sail still up. Of course, I am assuming this unfortunate squall doesn't happen when you are close into shore.
I recall in 2000 when a 60 knot squall of some 10 minutes' duration hit my club, during a C&C regatta of all things. A 41 footer tried to motor in through the gap, but simply couldn't...the cross wind was too much. Coming about just by the small shelter of the swamped breakwall and running off into the lake was far safer.