Is your onward flight domestic? And both flights are on the same ticket?
If so, I think 40 mins is plenty for a domestic to domestic transfer.
I wouldn't call Naha a small airport - but the domestic terminal is on a "human scale". Basically there are two satellites and the walk between them is maybe 10 mins.
If you're transferring to an international flight, I have no idea.
Your main concern at Ishigaki and Naha may be the weather. Okinawa gets more storms than other parts of Japan.