An extra badge based on already granted badges number?

Hi. I was wondering if we could create a special badge for users already being granted with 30+ badges ( excluding system and discobot ).
So far this is the closest query I’ve found but is not for this use.

Edit: I finally succeeded, (my very first created badge :smile: ) if anyone is interested here it is

SELECT user_id, current_timestamp granted_at 
FROM user_badges  
GROUP BY user_id 
HAVING count(*) >= 30