UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LgcrD2XTo3eVWhh3El2AwrcBlzlpfvSx49W1727OgEU=' 
WHERE 
  key_id = '13e55c27c2a2e668b77db8da8568b4dcbf68d3ca1e90f447a3d3f5e4df58fded' 
  AND (
    token = 'LgcrD2XTo3eVWhh3El2AwrcBlzlpfvSx49W1727OgEU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017