Explaining the rise and maintenance of cooperation is central to our understanding of biological systems and human societies. When an individual's cooperativeness is used by other individuals as a choice criterion, there can be competition to be more generous than others, a situation called competitive altruism. The evolution of cooperation between non-relatives can then be driven by a positive feedback between increasing levels of cooperativeness and choosiness. Here we use evolutionary simulations to show that, in a situation where individuals have the opportunity to engage in repeated pairwise interactions, the equilibrium degree of cooperativeness depends critically on the amount of behavioural variation that is being maintained in the population by processes such as mutation. Because our model does not invoke complex mechanisms such as negotiation behaviour, it can be applied to a wide range of species. The results suggest an important role of lifespan in the evolution of cooperation.