Here's another way to do something similar to the above:
This rule doesn't test for the door being closed first with a contact sensor, but that could easily be added if you want. What this rule does do is monitor one lock: if unlocked, it will set a timer for 30 minutes, then lock the door. If the door gets locked in the meantime, this delay gets cancelled, which you may find useful if you leave it unlocked for 29 minutes, then lock it, then unlock it again and don't want it to automatically lock in 1 minute (which is similar to what this rule would do without the "Cancel Delayed Actions" and the "cancelable" flag set on the delay, which affects all subsequent actions--and is an issue you'd face with both of the rules provided above).
As for Rule Machine itself, it's not super-intuitive, but it is intended to be an advanced tool for when you are (hopefully) familiar with the platform and find that a stock app can't do what you want. Reading the documentation is practically essential to understanding how it works, and luckily there is some good documentation with lots of examples. Here is the Community thread on the latest version (which might assume a bit of prior Rule 3.0 knowledge, but there are similar docs for those): [Released] Rule 4.0. As you've seen above, the community is also usually willing to help.