afaik, there's no such thing like this in sql
you can code the priority level in PHP, or add a column for: 'rank' and increment it everytime someone downloads or rates the file
example: if you want user rating to be higher priority than number of downloads, you can make
download: rank + 1
rating: rank + 3
but imo, it's better if you make the script able to sort based on all 3 columns