Then why have the lock at all? Or if you have the lock for world reasons, why bother requiring a roll? Unless the delay matters, all this does is allow the party to Long Rest before continuing.
There needs to be consequences, and that's where adventure design comes in. If you cannot pick the lock, you could use the Knock spell or you could smash the door, but both of those have noise factors. This could add an encounter (as guards come running), make the encounter harder (as the enemy gathers together), ruin surprise, or even provide a chance for the party to be surprised. A unassailable lock might force the party to go a long way around (taking time and causing additional combats). Finally, a treasure room might become inaccessible, denying the party loot.
Why do people have locks in the real world? Not so the local thieves can have a chance to use their skills. There are consequences. It keeps them out.
People use locks to keep people out of things. And if somebody really wants to get past it, they will. It's a deterrent, slows things down. That's all. And if somebody is proficient in picking a lock, they'll eventually get in. Why? Because most people aren't building and installing locks to foil people who know how to pick a lock. That's a very small percentage of the population, and designing a pick-proof lock is more complex and expensive. And in a pseudo-medieval fantasy world, if you're going to go to that trouble, you're better off considering a trap or magical protection.
If the lock is on a door with no other immediate threat, then there isn't any problem taking more time to try. On the other hand, it does potentially cause noise. So if there's something on the other side, there are more chances for them to hear it.
I'm not a fan of the idea that "there has to be consequences" just for the sake of consequences. Most of the time the locks don't serve a mechanical in-game purpose, they serve a world and story purpose. My world isn't designed to always provide consequences, or police the use of rests, or even to make it interesting.
If you're in a place where people live, such as a dwarven stronghold, then I'd expect each residence to have a lock, and I'd expect it to be locked when nobody is home, or if it's during "night." If it's abandoned, it depends on why, and what has happened since, as to whether those doors are locked now. It has absolutely nothing to do with what sort of consequences or challenges it presents a party of adventurers.
If there are nearby creatures or guards that might be on patrol, or hear them attempting to pick the locks (or the impatient adventurers waiting for them to pick the lock) then fine. But I'm not throwing them in in case somebody fails their first skill check.
Nor am I going to nerf a character's abilities due to a bad roll. Somebody with expertise in picking locks shouldn't "fail forever" because they rolled a 3. Nor should they have to wait until after a short rest, gaining a level, or any other arbitrary way DMs try to make a lock permanent. If you're really intent on their failure sticking, then make it a lock they can't pick. Otherwise, they can pick it, eventually.
Of course, while they are trying, the rest of the party is doing something. Maybe it is a good time to take a quick break and have a snack. Adventuring is hard work. Maybe they pick on the rogue for not being able to pick the lock. Maybe they get tired of waiting and just kick down the door. Maybe they wander down the other passages a bit to investigate alternatives. The rest of the world doesn't come to a halt just because they are spending a few minutes picking a lock.
I also don't do re-rolls. If the lock is within the capability of the PC (20 + skill modifier), then they
will eventually get it. I use the difference between the roll and the DC as an element of time. If there's no other threat at the time, then I just tell them it takes a few moments. If there are other considerations, I let it play out.
For locks they cannot pick because they are not skilled enough - first I'll mention that it's a well made lock, not like any they have specifically seen before. If there is no other threat, then I'll also eventually tell them that they've been working at it for a few minutes, and they just aren't getting it. They can choose to take more time or not. If there's a more imminent threat, I'll just let it play out.
One of the things that I find is severely lacking in modern D&D is the passage of time. You don't have to play out all of the time that passes. But it used to be that there were a lot of empty rooms, and rooms with little of interest. In my campaigns, characters act like, well, people. Most of the time about 8 hours of adventuring a day is more than enough. They expect to have things like breakfast, lunch, and dinner, and a break every once and a while as well. What takes many groups a day in game time, takes mine several days. The exploration of a large catacombs (look up maps for the real ones in Paris and Rome), made more difficult due to a few non-standard rooms that made mapping difficult, literally took the party months to explore and exit - and it was about 3 months of game time, once a week.