UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MnZ5nvcOIOmy7IKETaAYr0Gnr7Zum3RkLFh+6fOR34k=' 
WHERE 
  key_id = '223619623e286e504eacd59209c915e6f8ff7f170a2e1bbb4932a35354c2281d' 
  AND (
    token = 'MnZ5nvcOIOmy7IKETaAYr0Gnr7Zum3RkLFh+6fOR34k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037