UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hSI92aydlNaGKuTFxwziGUJqx10yQndFFn5JF8p0gBc=' 
WHERE 
  key_id = 'e09a4c9377c30ab12c409cbbf9b11bba06d4f59727ea8e74176f555f175e4785' 
  AND (
    token = 'hSI92aydlNaGKuTFxwziGUJqx10yQndFFn5JF8p0gBc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040