What would I look for if I was buying a used D40?
1. Check for any dead pixels in the LCD by taking a few photos of different light qualities and just closely inspecting it. They should probably render white or black so take both light and dark shots to see.
2. Remove lens and make sure there isn't a ton of dust on the mirror or focus screen above it (semi clear plastic piece). As stated above, check the lens for dust and any scratches. If anything looks like a scratch, take a lens cleaning cloth and make sure it's not just a smudge. I would even make sure there isn't too much stuff dust in the viewfinder (not on the exterior glass). If there is, that's probably a good indicator that body needs a good cleaning.
3. Snap a shot with the scene totally blown out (use flash, 1-2 sec exposure, ISO 400 in normal light). You'll want this completely white, no detail. Then take that image, upload to laptop if you have it, and check for dead pixels on the sensor. They should show as little black dots. If you don't have your laptop, use the LCD and the zoom function the best you can. If it has any spots, pass on it.
4. Inspect the usual camera operations. Try all the different modes, shoot on continuous mode at highest frame rate just to make sure shutter is still operating as it should (no stalling, strange noise, etc.).
5. Check the number of actuations (shutter count). This you'll need a laptop for. First download
Opanda Exif Viewer onto your computer. Take that same blown out shot you inspected the sensor with and check the EXIF data on it. The shutter count should show on the camera towards the bottom of the info. This is basically like car milage, the higher the number, the more use put on it, thus it should reflect a lower price.
You should spend a good 15 minutes shooting and inspecting it. Ask the seller a lot of questions and really just do your best to make sure you're getting a camera that has not endured heavy use. Remember you don't get any warranty on this so it's important you find something you won't need to send in for repair soon after. Good luck!