UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QGa5h6iZ857PexaqoM6SNsFmn5iWjy0JGb4bRsl8Ptg=' 
WHERE 
  key_id = '80ad54d45696643f9a38c9b9b161d6107234fe78b58487ce71abd3a964d6f081' 
  AND (
    token = 'QGa5h6iZ857PexaqoM6SNsFmn5iWjy0JGb4bRsl8Ptg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046