The nature of the Caliphate (Khilafah) changed after the first 30 years of the Khulafah Rashidah. It became more temporal in nature however it remained a Caliphate until 1924 when secular nation states emerged.
The Caliphate did not last thirty years because the Rasool said the Khulafaa will be many and in no way does 4 or 5 amount to many.
Writing nearly two centuries after the Mongol conquest of Baghdad, the classical jurist al-Shirazi insisted on the centrality of the Cairo Abbasid caliph for contemporary affairs, in both legal and metaphysical terms. In his explanation, the honour of the caliphate originates with the first of men and prophets: Adam.
Shirazi invokes God's words to the angels, "I am putting a trustee (khalifah) on earth" (Qur'an 2:30) to convey the honuor of God's designating Adam as the first of caliphs responsible for tending to God's creation. In addition to selecting Adam for this high and noble station, God further distinguished him by placing this successive leadership in his progeny (khala'if in Qur'an 6:165). Accordingly, he describes the word caliph or khalifah as the noblest of all titles. The best of creation in each era inherit this paternal role (magām al-ubuwwah) from the father of humankind and no king or sultan can compare with the glory of a caliph. Indeed, the caliph commands what God commands, and therefore opposition to him in reality means disobedience of God.
Hence, the Caliphate lasted more than 30 years and the meaning of the Hadith, therefore, is that its purest form would last for 30 years.
Read this for a detailed answer with evidences