CBPAllWorkflowPersister::getLockerQueryCondition: Bitrix method

      
<?php 
//  CBPAllWorkflowPersister :: getLockerQueryCondition()
//  /dist/bitrix/modules/bizproc/classes/general/workflowpersister.php:242

    
protected function getLockerQueryCondition()
    {
        global 
$DB;

        if (!static::
LOCK_BY_TIME)
        {
            return 
"(OWNER_ID IS NULL OR OWNER_ID = '".$DB->ForSql($this->serviceInstanceId)."')";
        }

        return
            
"( ".
            
"    (OWNER_ID = '".$DB->ForSql($this->serviceInstanceId)."' ".
            
"        AND OWNED_UNTIL >= ".$DB->CurrentTimeFunction().") ".
            
"    OR ".
            
"    (OWNER_ID IS NULL) ".
            
"    OR ".
            
"    (OWNER_ID IS NOT NULL ".
            
"        AND OWNED_UNTIL < ".$DB->CurrentTimeFunction().") ".
            
") ";
    }