#include <boost/preprocessor/comparison/and.hpp>
#include <boost/preprocessor/control/expr_iif.hpp>
#define INSERT_AND(p, q, text) /* ... */ \
BOOST_PP_EXPR_IIF( \
BOOST_PP_AND(p, q), \
text \
) \
/**/
INSERT_AND(2, 3, abc) // expands to abc
INSERT_AND(0, 7, xyz) // expands to nothing