Being unemployed raises heart attack risk by a similar magnitude to smoking, a study suggests.