In addition to mechanical components, digital cameras also have more electronic parts in them, and electronics can fail suddenly without warning, like CCD malfunction or burnout. I've got film cameras (both manual and autofocus models) that are more than a decade++ old but still function perfectly, however I will not hold onto any DSLR for more than 2 years.
Good lenses, if cared for properly, can last several years, but probably not as long as the old manual focus lenses because AF lenses have more gears and moving parts.