Statutory warranty on used cars in Queensland is 3 months/5,000kms for dealer-bought used cars which have less than 160,000kms and are less than 10 years old.
Mazda's represented warranty is 3 years.
Unless there's some extended warranty in place, it looks like you're out of luck. However, modern engines should last well in excess of 100,000kms; so 87,000km is premature. You could contact Mazda and see if they're willing to look into it.
What I would be doing first is talking to the mechanic who says you need a new engine. Find out whether it actually does, and what their opinion of the cause is. If it has simply been poorly maintained or improperly used, I wouldn't bother talking to Mazda.