You need an object reference of the type AMyDoorActor or the Cast will fail.
When you call Cast it is like saying “I have this object and I know it is of type AMyDoorActor, please let me use it as such”.
Note that if the Cast fails the game will crash unless if you check if MyDoor is not a nullptr before using it. If you want the game to crash if it is null you can use CastChecked instead.