UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hcjohDoyfTzsJLuhwN6avqn7jsGM1JB7RN0ypMqZk7s=' 
WHERE 
  key_id = '9a1ca18ba1888f49160897c80b8113f7e54f581158b3676f8fbaddc028aed887' 
  AND (
    token = 'hcjohDoyfTzsJLuhwN6avqn7jsGM1JB7RN0ypMqZk7s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043