SELECT 
 * 
 
FROM 
 `lead` 
 
WHERE  
  IF( :state<>'', IF( :state='all', true, `state` = :state ), true )
 AND 
  IF( :shape<>'', IF( :shape='all', true, `shape` = :shape ), true )

ORDER BY
 `created` DESC
 
LIMIT 
 :limit 
 
OFFSET 
 :offset
 
