\Bitrix\Main\Loader::includeModule('sale');
global $USER;
$userId = $USER->GetID();
$productId = 45;
$order = \Bitrix\Sale\Order::getList([
'select' => ['ID'],
'filter' => ['USER_ID' => $userId, 'BASKET.PRODUCT_ID' => $productId],
'limit' => 1
])->fetch();