We need ZDF (Numbers, Data, Facts) in order to be able to help you specifically. So, please provide the last letters of the two M-STGs

. Is one of them a completely metal-cased unit, or is it an older one with a plastic casing (MSA12)?
If the WFS (Window Film Sensor) were faulty, the engine would start but stall after 1 second. So, that's not the issue in your case. However, this car should have had a WFS installed since 1995 (or possibly from 1994, if I remember correctly). It's possible you bought an older MSG (Motor Steuergerät - Engine Control Unit) that doesn't require a WFS, which is why it's working.
The letters on the MSG indicate both the hardware version and the software. For example, you might have installed an MSG intended for a different engine (e.g., AFN). This sometimes works, but certain parameters may not be as optimal for your 1Z engine.
Despite that, I can't think of any reason why your engine should shut off after half an hour and then fail to restart, and how that would be directly related to the MSG (Main System Module). I suspect it's more likely a problem with the power supply or wiring.
For me, the central point of investigation would be the ignition switch. Has smoke ever come out of it? That's what happened with my Golf 3...
Greetings.
Sure.
Here is the translation of the text from German to English:
"Guste" means "gust" in English. It refers to a sudden and strong gust of wind.