Don't do it and currently for €40k you will be lucky to buy a caravan, properties are cheap only for ONE REASON
Remember to ask about the rates for the real ongoing costs, comunity fees
Property prices in certain areas are increasing and even for a basic apartmemnt around the Orihuel Costa, where there is life and operation golf courses the prices start at €70
You will need to add 13% -14% to the price for buying fees, 10% property transfer and thge rest for the notaly and legal fees
Typical completion time in Spain for a resale 6 - 8 weeks, can be done sooner
If you are taking 14% of of 40k then you are spending €34k, trying searching for any property, anywhere in Spain for this proce, sorry forget it, your budget is way to low
If you take a mortgage there are some very low rates but add another 4% to the buying costs, then add fees for life insurance