Can you show me how your table is designed? Your query can be made better.
SELECT '%s' FROM `licenses` WHERE 1
I would do something like
SELECT * FROM tblLicenses WHERE ServerIP='%s'
No results means unlicensed. Or if you have a column that holds a license status (0/1) for if you withdraw a license without deleting the record from the table you can then check that.