UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u8VYBksFohY46PJ59h/hUdvOqIlEN2iuRdDoCPa4Crg=' 
WHERE 
  key_id = '4686d0f4efe056862953c148ac96092a75f06f8dced1b686f1032b8e8cd02170' 
  AND (
    token = 'u8VYBksFohY46PJ59h/hUdvOqIlEN2iuRdDoCPa4Crg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029