Благодаря подсказке
Dmitry Bay появилось решение.
Может, кому-то пригодиться:
$sql = "SELECT relatedoptions_id, COUNT(relatedoptions_id) FROM abvv_relatedoptions_option
WHERE product_id = '" . (int)$product_id . "' ";
if ($options) {
$sql .= "AND (";
$i=0;
foreach ($options as $key => $option) {
$i++;
if($i>1){
$sql .= " OR ";
}
$sql .= " (option_id=" . $key . " AND option_value_id=".$option.")";
}
$sql .= ")";
$c = count($options) - 1;
}
$sql .= " GROUP BY relatedoptions_id HAVING COUNT(relatedoptions_id) = ". $c ." ";