I just sold a property with the tenants still there.
This is the deal I set up. The listing agent (the realtor I hired) was the only person with a key (no lock box). I took the realtor to the tenants and introduced them so they knew who was going to be there to show the place. Every time the place was to be shown the tenants received a 24 hour advance notice of entry. My agent had to be present each and every time.
This was not an issue. My realtor wasn't happy about how I insisted he handle it, but he had to admit it was the easiest and smoothest process he had ever been involved with and would recommend it to others who sell rental properties.