Gotcha. You want to keep the doors unlocked the whole time unless one is open, then lock both.
Are you wiring both unlock coils to the same physical output? Are you monitoring the status of the door locks separately from the doors being closed (you must be...)?
Based on the locks being power to release and being monitored separately from the gate status, I threw together a quick program that would energize an SOF for the locks if both gates are closed and de-energize it if either is open. There's another SOF for the hazard that will be energized if:
1) both doors are closed
OR
2) Gate A is closed AND Gate A is locked
OR
3) Gate B is closed AND Gate B is locked
However, it's probable (almost certain) that there would be a race condition that could cause the hazard's SOF to de-energize in the window of time where Gate A is opened before Gate B has a chance to show locked. You may be able to put in some time delays or use an OFF_Delay output for the hazard to compensate for that, but you'll have to be really careful to make sure your gates are far enough from the hazard for that to be ok.
I would strongly suggest leaving both gates locked all the time until an operator presses a button to open one of them. That will unlock the gate they want to open for a time, maybe 5 or 10 seconds. You would have to use a separate SOF for each unlock coil.
It's been a while since I used one of these, and I found them to be pretty limited and expensive. By the time their cost covered enough of the simple SI relays, the I/O count was too limited. Just tinkering around quickly with it here, I'd forgotten how limited it really is. I've found that other brands are more capable and a lot more cost effective. My current go-to is the Keyence GC-1000.