You always hear that the Boeing 737 have been flying for so many years and the Airbus A310 for that many years, but of course that include new airframes being produced all the time. What is the lifespan of one airframe on average in general use by airlines, before it is scrapped?
Metal fatigue is normally the limiting factor of an aircraft's lifespan. Fatigue cracks build up every flight (at start & landing), called a cycle. Therefore the design life of an aircraft is typically given in cycles.
Metal fatigue cracks, source: Boeing
For long haul aircraft, that make relatively few cycles, the design lifespan is in the order of 40 000 cycles. For short haul the number is higher, sometimes up to 111 000 cycles.
For example, the Boeing 747 has a design number of cycles of 35 000, the MD-80 has 110 000.
An aircraft should be operable for about 30 years before reaching the cycle limit. The lifetime can be stretched by special inspection and maintenance programs.
In many cases the decision to retire an airframe is economical rather than just "it's old". Proper maintenance can extend an airplane's service life almost indefinitely but it gets more expensive with age/flying time/cycles.
Also, new airplanes are cheaper to operate. If buying a new plane saves the purchase price in fuel in 5 years (quite possible) then you get one. It will not need any major maintenance in that period, further reducing the total cost of ownership. For example, a 707 and 737 are comparable in terms of capacity and range, but a brand-new 737 at \$90 million will cost a lot less over 5-10 years than a used 707 picked up for \$1 million.