Fixed certificate query for just MySQL