Use a dry brush, like an artist's brush, to take loose dirt off. Make sure you're holding the lens so that dust will fall down and away, rather than on the back lens element. Get a bottle of isopropyl alcohol. Pour a little into the bottle cap, dip the end of a cotton swab into the liquid, squeeze out the excess alcohol from the swab (you just want it moist), then drape a microfiber cloth over the wet swab end. The moisture in the swab should go through the microfiber cloth, making it slightly damp. Use that damp end to wipe the contacts. Then wrap a dry, clean portion of the microfiber cloth on the dry end of the cotton swab and use that to wipe the area you just wet-wiped. Lightly lay the lens cap and leave it for about ten minutes to make sure it's thoroughly dry before you tighten the cap or try attaching it to the camera.
Follow the same procedures for the camera body mount contacts, hotshoe, flash foot, etc. Of course, makes sure that everything is off and batteries are removed when you do this. Make sure you have plenty of light and that you see where you are wiping (don't poke around there blindly). Hold the lens & camera body so debris will fall down & out, not in. Allow plenty of time for the contacts to dry fully before you put in any batteries, tighten caps, or attach/use the camera/lens.
I've heard that a quick, in-the-field way to clean the lens contacts is to use a rubber pencil eraser. That might be fine until you can do the more thorough cleaning, but my concern is that it might add dust to the sensor.