Ambulances took more than an hour to respond to over 20,000 emergency calls in the past five years, new figures show.