UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NOWxddAE65BzaijmfFw8WleEcU+xaEbtStkfx1QDrSM=' 
WHERE 
  key_id = '8d4584e96ab0938faf7f4faad6ac79e181fd642373b2a25ff7c6c8d3353d016f' 
  AND (
    token = 'NOWxddAE65BzaijmfFw8WleEcU+xaEbtStkfx1QDrSM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045