You can use the set_point_disabled method of your AStar2D instance to temporarily disable a point.
This means: Place a point at your door. When you do a path search for a character, check if this character has the keys necessary to traverse the door. If yes, then enable the point of your door - if not, disable it.
For convenience, you probably want a class either wrapping or extending AStar2D to have a clean interface.