UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1wqjmSjnE8kOBdPeP2TRCOJlESjQytV+j48ze+jewws=' 
WHERE 
  key_id = 'b3c43f1b15382147a24bab5b1d47643627b044c5b96502f4b822d9fbcfcef62d' 
  AND (
    token = '1wqjmSjnE8kOBdPeP2TRCOJlESjQytV+j48ze+jewws=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037