Drinking two to three cups of coffee a day is associated with a longer lifespan and lower risk of heart disease compared with avoiding the brew, a new study suggests.