ESP32 is safe enough to control a door lock
Commercially available residential and commercial locks use off-the-shelf, readily available microcontrollers, and the wireless locks again, use off the shelf modules/radios. There is nothing special about them. The security comes from the knowledge of attack vectors, and good hardware and software design to protect against them. So to directly answer your question, sure it's safe, if it's a good design, but you're really asking the wrong question.