Night Shooting Advice
First of all, unless your buying a Non-DX lens or Camera, I would suggest you save your money, Nikon is going towards FX and DX will still work (one assumes indefinitely) but your not going to get the full value out of it. Where as most film lens should work wonderfully on a FX camera (again not as good as a FX lens, but for 99.999% of people they won't notice).
That said for Night Photography, unless your subject is close enough to the Camera for the AF support light to illuminate them or its bright enough for the camera to get a lock, having a AF lens is a little pointless.
If you want a walk around night-time lens, speed is key. F/1.2 is the fastest and by far the most expensive. Its also quite hard to focus, took me about 6 months before I could do it quickly & reliably.
Nikon
offered three f/1.2 lens, the first is the 58mm
Noct-Nikkor, which is specifically for noctural photography, the 55mm f/1.2 or the
50mm f/1.2. Now they are all fast and manual focus, but the 50mm or 55mm can be purchased used in your price range.
As you get more specialized lenses the cost can creep up on you, since your D40 will make many autofocus lens manual on that camera, it may be too your advantage to buy a used f/1.2 lens if its in good condition.
That all said, I've seen a D700 do some amazing work in very dark conditions & f/2.8, DSLRs are improving their ISO and grain reduction by leaps and bounds. So in the future fast lenses may not nessarily be needed; who knows!
*** Note: I know there is faster lenses than f/1.2, but in all seriousness they won't meet the OP needs.