UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+pVGFehGYix0+yQRexxZdAMPAQU+iCTATrxJw9G8ivE=' 
WHERE 
  key_id = 'a00868d59635b712bcd7e535abb141e77c84e1e28e2e059875eb4a75d7c42875' 
  AND (
    token = '+pVGFehGYix0+yQRexxZdAMPAQU+iCTATrxJw9G8ivE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029