Best way to a binary sensor

Isn’t it easier to just base your automation on the 50 seconds without move detection?
If door is open, you wait for motion clear for a maximum of 50 seconds. Then, if it times out, you can stop the automation, otherwise turn off the light.

A motion sensor is not supposed to become clear instantly.

There is blueprint for that specific case.

or, even better

Based on last_update