When shopping, I would be looking for generally clean kegs on the outside - take a wet rag with you to wipe off dust and make sure it’s just dust. No major dents which might make it leak or reduce capacity. I’d ask about the history of the keg - the best ones I have gotten were from a brewery where they had a bunch of kegs from other breweries where the other brewery wasn’t willing to come get it. If the spear is out, I smell it. If it’s in, I push down on the metal ball and hope that some liquid comes out.
Once I get it home, I wash the outside in a large garbage can with plain water. Then take it out and wipe the outside down down with PBW cleaner solution and hose it off. Let it dry then remove the spear. I then fill it about 1/4 full with water, put in a barrel bung and agitate it - shaking left right up and down. Dump water out and see what comes out. Repeat with a PBW solution. I then put it on a Carboy washer again with PBW and let it run for 15/20 minutes. Then repeat with water to get all the PBW out. Keep an eye on the washer reservoir to see if the solution or water is getting murky. If so, dump out the solution and start over with fresh.
After all this it should be pretty clean. I fill it to the top with water and let it sit overnight. In the morning, dump the water but looking to see if anything dissolved. Next to Last step is one last rinse with a citric acid solution and then water again. Last step, pour in about a gallon of k meta solution, insert bung and shake it around to make sure all surfaces get coated. Dump out k meta and fill with wine.