When a hen lays an egg, the last thing she puts on them is a wet layer we call bloom. It quickly dries and forms a barrier that helps prevent bacteria from entering the egg. It’s not perfect but it’s pretty good. A clean egg with the bloom intact can usually set on your kitchen counter for a long time without bacteria getting inside, which is what causes it to go bad.
For bacteria to multiply the egg needs to be a minimum temperature. The warmer it is the faster the bacteria multiply. An incubated egg is the perfect temperature for bacteria growth but hens can hide a nest and lay eggs for over two weeks, then sit in them for three weeks with bacteria hardly ever getting inside. Ducks and turkeys go longer. That bloom is pretty good.
If the bloom is not intact, bacteria can enter the egg. If the egg is dirty with poop or dirt, the bloom may not be intact, though minor dirt isn’t that big of a risk. If you wash the egg (warm water as you mentioned is good) or if you scrape or scratch the dirt off, the bloom will probably not be intact.
In a refrigerator the temperature is well below a good temperature for the bacteria to multiply. Washed eggs will last a long time in the refrigerator before going bad. I can’t give you a specific time they will remain good since conditions vary, but you are generally talking weeks or even months, certainly not days.