If your Car uses an electronic Key Fob, you cannot lock the Keys inside the Car.
You are in the car. You open the door and hit the lock button on the fob, but leave the key fob in the center console (distracted by whatever). You get out of the car and close the door. You are locked out.
Except many cars now have a code panel outside the car that will unlock the car.