UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FkKy0ft29F0VGjvpX1OVIZi5kvF1ed6vDQPUibx1TaU=' 
WHERE 
  key_id = '7bf5fbda505c78fc8d955460ee36d93b39957b16d900f3411ab25253fd754be2' 
  AND (
    token = 'FkKy0ft29F0VGjvpX1OVIZi5kvF1ed6vDQPUibx1TaU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040