On my 2018 SQ5 I had a similar issue. Had it towed to the dealer and they also wanted $30,000 to replace the engine. It was under 50,000 miles, but just over the 4 year warranty by 2 months. They said came down to $15,000 but I still decided it was too much. I took it to an independent Audi mechanic and he inspected the engine and found that it had a broken valve spring. He fixed it for $4,500.