The lights turn off when the zone is active

The reason why your flow doesn’t work as you wish is, because you use the delay card instead of a timer, like Peter does.
The problem with the delay card is, once the flow has been started because the zone became inactive for a short moment, the light will be switched off after 30 seconds, independent of if the zone was activated again within the 30 seconds.

So you can use the card “Zone is inactive for x minutes”, or you can use a timer (see Peter’s example, or this tutorial).