UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TnSjrhngFs3dZmourNGl1AU/IYmKuxT5ttOgU5/uXtk=' 
WHERE 
  key_id = '87fa00c786d22ee36629bbca0057c858ff688edeb011d36e4fe866d6576c895a' 
  AND (
    token = 'TnSjrhngFs3dZmourNGl1AU/IYmKuxT5ttOgU5/uXtk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050