Do you wear cycling-specific clothing? If so, 40 F should be a piece of cake. At that temperature, I would wear a thin wicking t-shirt, long-sleeve jersey and a vest on top if temperatures would be warming up on the ride, or a cycling jacket such as Gore Phantom over a long-sleeve base layer. On my legs, I would wear tights over bib shorts, or knicker bibs. Wool socks and shoes with toe covers. Fleece cap under my helmet.
I regularly ride in temps in the 20s-30s F all fall, winter and early spring with occasional morning commutes in the teens. I keep warm at those temperatures using the clothes described above, but will wear a cycling jacket rather than a vest at temps lower than 40 F, with base layers of varying thickness depending on how cold it is. I also wear warmer tights (Pearl Izumi AmFibs) on colder days.
Hands are the hardest to keep warm, and I have 4-5 different pairs of gloves that I wear depending on the temperatures. My warmest gloves (PI AmFibs) keep my hands warm down to the teens and are actually too hot when temps get above mid-30s. I often carry an extra pair of gloves while commuting since the afternoon temperatures are generally much warmer.