A sheriff or justice of the peace may grant a warrant under this section in relation to premises if satisfied—
that there are reasonable grounds for believing that—
an offence under section 2 or 3 has been or is being committed at the premises, or
the premises have been or are being used in connection with an offence under section 2 or 3, and
condition A or condition B is satisfied.
Condition A is—
that admission to the premises has been refused or a refusal may be reasonably expected, or
that notice of the intention to seek a warrant has been given to the occupier of the premises, or the giving of such notice would frustrate the purpose for which the warrant is sought.
Condition B is—
that the premises are unoccupied, or
that the occupier of the premises is temporarily absent.