UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B1Tnv3+2MppR5u2y8dMVG6m4g3M2AsBgFavpu9J+ZSU=' 
WHERE 
  key_id = 'c2d8ba010162f15b53942941962712e6773438caa2b53bb79d2683da12bbf835' 
  AND (
    token = 'B1Tnv3+2MppR5u2y8dMVG6m4g3M2AsBgFavpu9J+ZSU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041