A bomb blast at a mosque in Pakistan's Khyber Pakhtunkhwa killed five worshippers and injured dozens before Ramadan.