Improve mysql query for getting assets