UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IdOsffzdL9iaCGUeYmp9ky+IlWwzHwofett1ic8kkpw=' 
WHERE 
  key_id = '5f0bd126f829d9f5337a7453e4eee718a12a229a853dd7773d5b36f069b67b33' 
  AND (
    token = 'IdOsffzdL9iaCGUeYmp9ky+IlWwzHwofett1ic8kkpw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040