Piwik as sales tracker that allows complex queries?

On a site, every click on a product should be registered by a sales tracker: price, type, etc.

The sales tracker should provide an API so that complex queries can be performed, such as: Which products of a type “teapot” had a price below 20 EUR?

[li] Data should be available for querying no later than two hours after it has been recorded. For example, there are reports that Google Analytics may take up to 24h to update data. That is not acceptable.
[/li][li] Querying doesn’t need to be fast, but recording does (of course).

I assume that Piwik is the right tool for this job, but how to get started? How would the queries be done?

See: http://piwik.org/consulting/ for (paid) help with this

Well, first I would like to know if Piwik is the right tool for the task. I am a developer myself, currently evaluating various options for solving the problem at hand. That being said, it could be a possibility to bring in an additional developer, though the budget is rather low.

I didn’t mention: The results of the queries has to be converted to XML, but that step is possibly better done outside of Piwik.